<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/axios.min.js"></script>
</head>

<body>
    <script>
        console.dir(axios);

        //拦截机
        axios.interceptors.request.use((config)=>{
            console.log(config);
            console.log(config.url);  //请求的地址
            config.headers.token="haoren" //给请求头设置token
            return config
        },(err)=>{
            console.log(err);
        })

     axios.interceptors.response.use((res)=>{
         console.log(res.data);
         let data=res.data
         return data
     })


        axios({
            methods:"get",
            url:"http://localhost:3000/cook"
        }).then(res=>{
            console.log(res);
        })

    </script>
</body>

</html>